//获取我的信息数据
export default {
    //用户信息
    user_profile(state, getters, rootState) {
        return _.extend(rootState.userProfile, { id: rootState.userProfile.uid });
    },
    user_current(state, getters, rootState) {
        return _.extend(state.current)
    },
    user_attr(state, getters, rootState) {
        const renderData = {
            headinfo: {
                item: {
                    icon: getters.user_profile.head,
                    head: getters.user_profile.head,
                    intro: getters.user_profile.name,
                    pageName: 'edit-user-head-page'
                },
                nextState: {
                    val: {
                        key: 'head',
                        content: getters.user_profile.head,
                        displaycon: getters.user_profile.head,
                        placeholder: '请输入昵称',
                        total: 15,
                        dispatch: 'myCurrentPosition'
                    },
                    key: 'myInfo',
                    dispatch: 'myCurrentPosition',
                }
            },
            list: [{
                    item: {
                        icon: '',
                        name: '昵称',
                        intro: getters.user_profile.name,
                        pageName: 'edit-user-nickname-page',
                    },
                    nextState: {
                        val: {
                            key: 'name',
                            content: getters.user_profile.name,
                            displaycon: getters.user_profile.name,
                            placeholder: '请输入昵称',
                            total: 15,
                            dispatch: 'myCurrentPosition',
                        },
                        key: 'myInfo',
                        dispatch: 'myCurrentPosition',
                    }
                },
                {
                    item: {
                        icon: '',
                        name: '账户',
                        intro: getters.user_profile.account,
                        pageName: '',
                    },
                    nextState: {
                        val: {
                            key: 'account',
                            content: getters.user_profile.account,
                            displaycon: getters.user_profile.account,
                            placeholder: '请输入账户',
                            total: 15,
                            dispatch: 'myCurrentPosition',
                        },
                        key: 'myInfo',
                        dispatch: 'myCurrentPosition',
                    }
                },
                {
                    item: {
                        icon: '',
                        name: '性别',
                        intro: getters.user_profile.sex ? '男' : '女',
                        pageName: 'edit-user-nickname-page',
                    },
                    nextState: {
                        val: {
                            key: 'sex',
                            content: getters.user_profile.sex,
                            displaycon: getters.user_profile.sex ? '男' : '女',
                            placeholder: '请输入性别',
                            total: 2,
                            dispatch: 'myCurrentPosition',
                        },
                        key: 'myInfo',
                        dispatch: 'myCurrentPosition',
                    }
                },
                {
                    item: {
                        icon: '',
                        name: '个性签名',
                        intro: getters.user_profile.comments,
                        pageName: 'edit-user-nickname-page',
                    },
                    nextState: {
                        val: {
                            key: 'comments',
                            content: getters.user_profile.comments,
                            displaycon: getters.user_profile.comments,
                            placeholder: '请输入个性签名',
                            total: 15,
                            dispatch: 'myCurrentPosition',
                        },
                        key: 'myInfo',
                        dispatch: 'myCurrentPosition',
                    }
                }
            ]
        }
        return renderData;

    },
    my_setting(state, getters, rootState) {
        const renderData = [{
                list: [{
                        item: {
                            icon: 'icon-star-fill',
                            name: '我关注的',
                            pageName: 'my-fouce-page',
                        },
                        nextState: {
                            key: 'uid',
                            val: '',
                            dispatch: 'myCurrentPosition',
                            toolbar: false
                        }
                    },
                    {
                        item: {
                            icon: 'icon-folder-fill',
                            name: '我的收藏',
                            pageName: 'my-favorites-list-page',
                        },
                        nextState: {
                            key: 'forumId',
                            val: '',
                            dispatch: 'myCurrentPosition',
                            toolbar: false
                        }
                    },
                    {
                        item: {
                            icon: 'icon-timer',
                            name: '最近浏览',
                            pageName: 'recent-browse-page',
                        },
                        nextState: {
                            key: 'topicId',
                            val: '',
                            dispatch: 'myCurrentPosition',
                            toolbar: false
                        }
                    },
                    {
                        item: {
                            icon: 'icon-folder-fill',
                            name: '我的草稿',
                            pageName: 'my-draft-page',
                        },
                        nextState: {
                            key: 'topicId',
                            val: '',
                            dispatch: 'myCurrentPosition',
                            toolbar: false
                        }
                    }
                ]
            },
            {
                list: [{
                    item: {
                        icon: 'icon-folder-fill',
                        name: '反馈中心',
                        pageName: 'discovery-home-page',
                    },
                    nextState: {
                        key: 'uid',
                        val: '',
                        dispatch: 'myCurrentPosition',
                        toolbar: false
                    }
                }]
            },
            {
                list: [{
                    item: {
                        icon: 'icon-folder-fill',
                        name: '设置',
                        pageName: 'discovery-home-page',
                    },
                    nextState: {
                        key: 'uid',
                        val: '',
                        dispatch: 'myCurrentPosition',
                        toolbar: false
                    }
                }]
            },
        ];
        return renderData;
    },
    favorites_data(state, getters, rootState) {

        const renderData = state.favorites
        $$.each(renderData.list, function(index, item) {
            _.extend(item, {
                pageName: 'my-favorites-folder-page',
                nextState: {
                    dispatch: 'myCurrentPosition',
                    key: 'favoritesInfo',
                    val: {
                        id: item.id,
                        key: 'id',
                        dispatch: 'myCurrentPosition',
                    }
                }
            })
        })

        console.log(renderData)
        return renderData
    },
    forumData(state, getters, rootState) {
        var focus = state.focus.forum.list;
        var len = focus.length;
        const renderData = focus.slice(1, len);
        return renderData;
    },
    conceptData(state, getters, rootState) {
        var focus = state.focus.concept.list;
        var len = focus.length;
        const renderData = focus.slice(1, len);
        return renderData;
    },
    favoritesData(state, getters, rootState) {
        var focus = state.focus.favorites.list;
        var len = focus.length;
        const renderData = focus.slice(1, len);
        return renderData;
    },
    usersData(state, getters, rootState) {
        var focus = state.focus.users.list;
        var len = focus.length;
        const renderData = focus.slice(1, len);
        return renderData;
    }

}